<?php
/*
company:tiesh.com 
project:common
function: 支付功能

created by: 刘盾
created date: 2017-02-27
description:

modification v1.00
modified by:
description:
*/
namespace app\hongyanche\controller;

// class PayController extends Controller {
class Pay {
	
	//管理员现金支付
	function admin(){
		return json(model('pay')->admin($_REQUEST));
	}
	//会员账户支付
	function account(){
		return json(model('pay')->account($_REQUEST));
	}
	//会员账户自己支付
	function member(){
		$_REQUEST['selfPay'] = 1;
		return json(model('pay')->account($_REQUEST));
	}

	//微信/支付宝 刷卡支付
	function scan(){
		return json(model('pay')->scan($_REQUEST));
	}

	//微信支付js密钥 用于微信内置浏览器
	function tenpay_jsapi(){
		return json(model('pay')->tenpay_jsapi($_REQUEST));
	}
	//微信二维码网页支付密钥 用于非微信浏览器
	function tenpay_qrcode(){
		return json(model('pay')->tenpay_qrcode($_REQUEST));
	}
	function tenpay_qrcode_link(){
		$code = input('code');
		if(substr($code,0, 9)!='weixin://'){die();}
		return getQrcode($code);
	}

	//支付宝二维码网页支付密钥 用于用户主动扫码支付
	function alipay_qrcode(){
		return json(model('pay')->alipay_qrcode($_REQUEST));
	}
	//查询
	function query(){
		return json(model('pay')->query($_REQUEST));
	}
	//微信被动接收支付结果
	function receive_tenpay(){model('pay')->receive_tenpay();}
	//支付宝被动接收支付结果
	function receive_alipay(){model('pay')->receive_alipay();}
	//退款
	function refund(){
		return json(model('pay')->refund($_REQUEST));
	}

}
